/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ChessApps.Network;

import com.ChessApps.Interface.Interface;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author eikichie
 */
public class ThreadUpdateApps extends Thread{
   Interface ref;
        int i=0;
	public ThreadUpdateApps(Interface r)
	 {
		ref = r;
	 }
           
	public void run()
	 { 
		while(true)
		 {  
                     ref.updateEatenPieces();
                     if (ref.getNbPlayer() == 2){
                         ref.opponentReady();
                         ref.getServeur().dispatch("OpponentReadyStateCharged", 5);
                         ref.setNbPlayer(0);
                     }
                     try 
                     {
                       Thread.sleep(100);
                     } 
                     catch (InterruptedException ex) {Logger.getLogger(ThreadUpdateApps.class.getName()).log(Level.SEVERE, null, ex);}
                 }
	 } 
}
